﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Permissions;
using System.Text;
using System.Web;
using System.Web.UI;
using System.ComponentModel;

namespace JQuery.Net.UI
{
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
    [DefaultProperty("Script")]
    [ParseChildren(true, "Script")]
    public class ClientScript
        : Control
    {
        private string _script = null;

        [PersistenceMode(PersistenceMode.Attribute)]
        public string Event { get; set; }
        [PersistenceMode(PersistenceMode.Attribute)]
        public string Type { get; set; }
        [PersistenceMode(PersistenceMode.EncodedInnerDefaultProperty)]
        public string Script
        {
            get { return _script; }
            set { _script = value.Trim(); }
        }
    }

    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
    [DefaultProperty("Body"), ParseChildren(true, "Body")]
    public class Script
    {
        private string _script = null;

        [PersistenceMode(PersistenceMode.Attribute)]
        public string ID { get; set; }
        [PersistenceMode(PersistenceMode.Attribute)]
        public jQNetEvents Event { get; set; }
        [PersistenceMode(PersistenceMode.Attribute)]
        public jQNetScriptType Type { get; set; }
        [PersistenceMode(PersistenceMode.EncodedInnerDefaultProperty)]
        public string Body
        {
            get { return _script; }
            set { _script = value.Trim(); }
        }
    }
}
